﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Collections.Generic;

namespace exsportance.Silverlight.Common.Utils
{
    public static class CollectionUtils
    {
        /// <summary>
        /// Get all keys from dictionary
        /// </summary>
        /// <typeparam name="TKey"></typeparam>
        /// <typeparam name="TValue"></typeparam>
        /// <param name="dictionary"></param>
        /// <returns></returns>
        public static List<TKey> GetKeys<TKey, TValue>(this Dictionary<TKey, TValue> dictionary)
        {
            List<TKey> list = new List<TKey>();

            foreach (KeyValuePair<TKey, TValue> item in dictionary)
                list.Add(item.Key);

            return list;
        }

        /// <summary>
        /// Get all values from dictionary
        /// </summary>
        /// <typeparam name="TKey"></typeparam>
        /// <typeparam name="TValue"></typeparam>
        /// <param name="dictionary"></param>
        /// <returns></returns>
        public static List<TValue> GetValues<TKey, TValue>(this Dictionary<TKey, TValue> dictionary)
        {
            List<TValue> list = new List<TValue>();

            foreach (KeyValuePair<TKey, TValue> item in dictionary)
                list.Add(item.Value);

            return list;
        }
    }
}
